<?php
$baseUrl     = $this->baseUrl();
$qtArtefatos = count($this->rowSetArtefato);
?>
<h3><a>Artefatos (<?php echo $qtArtefatos; ?>)</a></h3>

<div><!-- listagem de artefatos -->
    <div class="ev-option-buttons">
        <a class="ev-dialog-form ui-state-default ui-corner-all"
           href="<?php echo $this->url($this->url, null, true); ?>"
           >
           <span class="ui-icon ui-icon-arrowreturnthick-1-n"></span>
           Enviar artefato
           </a>
   </div>

    <div id="app-div-artefatos">
    <?php if ($qtArtefatos) : ?>
        <table>
            <thead>
                <tr>
                    <th scope="col">Data</th>
                    <th scope="col">Nome</th>
                    <th scope="col">Usuário</th>
                    <th scope="col">Ação</th>
                </tr>
            </thead>
            <tbody>
             <?php
                $i = 0;
                foreach ($this->rowSetArtefato as $rowArtefato) :
                    $class = ($i++ % 2 == 0) ? 'class="cor"' : '';
                ?>
                <tr <?php echo $class; ?>>
                    <td><?php echo $this->dateFormat($rowArtefato->dt_upload, 'd/m/Y H:i:s'); ?></td>
                    <td>
                        <a href="<?php echo $baseUrl; ?>/corporativo/artefato/download/id/<?php echo $rowArtefato->id_artefato; ?>">
                            <?php echo $rowArtefato->st_nome; ?>
                        </a>
                    </td>
                    <td><?php echo $this->aUsuarios[$rowArtefato->fk_usuario]; ?></td>
                    <td>
                        <a href="<?php echo $baseUrl; ?>/corporativo/artefato/excluir/id/<?php echo $rowArtefato->id_artefato; ?>/?origem=<?php echo $this->origem; ?>">
                        X
                        </a>
                    </td>
                </tr>
                <?php endforeach; ?>
            </tbody>
        </table>
        <?php endif; ?>
    </div>
</div>